﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bids.Core.Infrastructure;
using Telerik.OpenAccess.Metadata;
using Telerik.OpenAccess.Metadata.Fluent;

namespace Bids.Core.DomainObjects
{
    /// <summary>
    /// 新闻表
    /// </summary>
    [Serializable]
    public class News : IEntity
    {
        /// <summary>
        /// 
        /// </summary>
        public virtual int ID { set; get; }
        /// <summary>
        /// 标题
        /// </summary>
        public virtual string Title { set; get; }
        /// <summary>
        /// 内容
        /// </summary>
        public virtual string Content { set; get; }
        /// <summary>
        /// 
        /// </summary>
        public virtual DateTime CreateTime { set; get; }

        public static MappingConfiguration<News> CreateConfiguration()
        {
            var threadMapping = new MappingConfiguration<News>();
            threadMapping.MapType(t => new
            {
                t.ID,
                t.Title,
                t.Content,
                t.CreateTime
            }).ToTable("News");
            threadMapping.HasProperty(t => t.ID).IsIdentity(KeyGenerator.Autoinc);

            return threadMapping;
        }
    }
}
